﻿#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include <QLabel>
#include "slabel.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWidget; }
QT_END_NAMESPACE

#define PADDING 2

enum Direction{
    UP = 0,
    DOWN=1,
    LEFT,
    RIGHT,
    LEFTTOP,
    LEFTBOTTOM,
    RIGHTBOTTOM,
    RIGHTTOP,
    NONE
};

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    MainWidget(QWidget *parent = nullptr);
    ~MainWidget();

private:
    void region(const QPoint &cursorPoint);

    void initGridLayout();


protected:
    void resizeEvent(QResizeEvent* event);
    void changeEvent(QEvent *e);
    void moveEvent(QMoveEvent *e);

    void mouseReleaseEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);

public slots:
    void windowclosed();//最小化 关闭
    void windowmin();
    void winmax();

private:
    Ui::MainWidget *ui;

    bool isLeftPressDown;
    QPoint dragPosition;
    Direction dir;

    SLabel *plb_A;
    SLabel *plb_B;
};
#endif // MAINWIDGET_H
